<template lang="pug">
  .button-wrap
    ButtonItem(
      v-for="(button,index) in buttonLists"
      v-bind="button"
      :key="button.name")
</template>

<script>
import ButtonItem from './ButtonItem.vue'
export default {
  name: 'buttonList',
  components: {
    ButtonItem
  },
  props: {
    buttonList: {
      type: Array,
      default: () => []
    } // 按钮组参数配置
  },
  computed: {
    buttonLists () {
      return this.buttonList.filter(button => {
        return !button.showFunc || button.showFunc(this.$parent, button)
      })
    }
  }
}
</script>
<style lang="sass" scoped>
.button-wrap
  .btn
    &:not(:last-child)
      margin-right: 8px
</style>
